package com.pitaya.winwine.repository;

import java.util.Date;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.CrudRepository;

import com.pitaya.winwine.domain.Vintry;

public interface VintryRepository extends CrudRepository<Vintry, Integer>, JpaSpecificationExecutor<Vintry> {
	
	public Vintry findByUserIdAndWineId(Integer userId, Integer wineId);
	
	public Vintry findByIdAndUserId(Integer id, Integer userId);
	
	public Page<Vintry> findByUserId(Integer userId, Pageable pageable);
	
	public List<Vintry> findByUserIdAndTotalGreaterThanOrderByEditTimeDesc(Integer userId, Integer total);
	
	public List<Vintry> findByUserIdAndDrinkingPeriodLessThanOrderByEditTimeDesc(Integer userId, Date drinkingPeriod);

}
